<template>
  <el-container>
    <el-header>
      <h2>语言合成</h2>
    </el-header>
    <el-main>
      <el-form :model="form" label-width="150px">
        <el-form-item label="语音输出设置">
          <el-switch v-model="form.voiceOutput" />
        </el-form-item>

        <el-form-item label="语音风格设置">
          <el-switch v-model="form.voiceStyle" />
        </el-form-item>

        <el-form-item label="语言和发音设置">
          <el-switch v-model="form.languagePronunciation" />
        </el-form-item>

        <el-form-item label="分句方式">
          <el-radio-group v-model="form.segmentationMethod">
            <el-radio label="标点分句">标点分句</el-radio>
            <el-radio label="长度分句">长度分句</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="自定义辞典">
          <el-input v-model="form.customDictionary" type="textarea" />
        </el-form-item>

        <el-form-item label="过滤敏感词">
          <el-switch v-model="form.filterSensitiveWords" />
        </el-form-item>

        <el-form-item label="敏感词辞典">
          <el-input v-model="form.sensitiveWordsDictionary" type="textarea" />
        </el-form-item>

        <el-form-item label="缓存设置">
          <el-switch v-model="form.cacheSetting" />
        </el-form-item>

        <el-form-item label="音频格式">
          <el-radio-group v-model="form.audioFormat">
            <el-radio label="MP3">MP3</el-radio>
            <el-radio label="WAV">WAV</el-radio>
            <el-radio label="OGG">OGG</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="采样率">
          <el-radio-group v-model="form.sampleRate">
            <el-radio label="16kHz">16kHz</el-radio>
            <el-radio label="24kHz">24kHz</el-radio>
            <el-radio label="44.1kHz">44.1kHz</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="比特率">
          <el-radio-group v-model="form.bitrate">
            <el-radio label="128kbps">128kbps</el-radio>
            <el-radio label="192kbps">192kbps</el-radio>
            <el-radio label="256kbps">256kbps</el-radio>
            <el-radio label="512kbps">512kbps</el-radio>
          </el-radio-group>
        </el-form-item>

        <el-form-item label="日志记录">
          <el-switch v-model="form.logRecording" />
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="save">保存</el-button>
          <el-button @click="cancel">取消</el-button>
        </el-form-item>
      </el-form>
    </el-main>
  </el-container>
</template>

<script>
import { ref } from "vue";
import { ElMessage } from "element-plus";

export default {
  setup() {
    const form = ref({
      voiceOutput: true,
      voiceStyle: true,
      languagePronunciation: true,
      segmentationMethod: "标点分句",
      customDictionary: "厨余垃圾,环卫工作",
      filterSensitiveWords: true,
      sensitiveWordsDictionary: "骗子,人渣",
      cacheSetting: true,
      audioFormat: "MP3",
      sampleRate: "16kHz",
      bitrate: "128kbps",
      logRecording: true
    });

    const save = () => {
      ElMessage.success("保存成功！");
      console.log("保存的参数:", form.value);
      // 在这里可以添加实际的保存逻辑，例如 API 调用
    };

    const cancel = () => {
      ElMessage.info("取消操作");
      // 取消逻辑，可以重置表单或执行其他操作
    };

    return { form, save, cancel };
  }
};
</script>

<style scoped>
.el-header {
  padding: 20px;
  text-align: center;
  background-color: #f5f7fa;
}
</style>
